{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1. 输出函数print"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "520\n",
      "98.5\n",
      "hello world\n",
      "hello world\n",
      "4\n",
      "hello world Python\n"
     ]
    }
   ],
   "source": [
    "# 输出数字\n",
    "print(520)\n",
    "print(98.5)\n",
    "\n",
    "# 输出字符串\n",
    "print('hello world') # 单引号内内容直接输出\n",
    "print(\"hello world\") # 双引号内内容直接输出\n",
    "\n",
    "# 输出计算后内容 \n",
    "print(3 + 1) # 含有运算符的表达式，会计算\n",
    "\n",
    "# 输出数据到文件当中\n",
    "fp = open('D:/test.txt', 'a+') # 输出在文件中，a+表示以读写功能创建，文件不存在就创建，存在的话就在文件内容后继续追加\n",
    "print('hello world', file=fp)  # # A.所指定的盘符必须存在 B.使用file=fp 把打印内容输出到fp当中，不用file的话文件里没有东西\n",
    "fp.close() \n",
    "\n",
    "# 不进行换行输出（输出内容在一行当中） 用逗号进行分隔\n",
    "print('hello', 'world', 'Python')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.6.3",
   "language": "python",
   "name": "python3.6.3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
